{% extends "base.html" %}

{% block body %}
{% if gr and gr_user %}
<form action="" method="post">
    <div class="grey"> 
    你授权的Google Reader账号为：<b>{{ gr_user['userEmail'] }}</b>，换个账户？ <a href="/auth">重新授权</a> 
    </div>
    <fieldset id="kindle_fieldset"> 
        <legend>Google Reader投递设置</legend>
        {% if success %}<strong class="error">保存成功！</strong> {% end %}
        <p>
            <label>Kinle email(收件人)</label><br />
            <input type="text" name="kindle_email" size="40" value="{% if gr and gr.kindle_email %}{{ gr.kindle_email }}{% end %}" />
        </p>
        <p>
            <label>Email(发件人)</label><br />
            <input type="text" name="email" size="40" value="{% if gr and hasattr(gr, 'email') and gr.email %}{{ gr.email }}{% end %}" />
        </p>
        <p>
            <label>标记为已读</label>
            <select class="bool" name="make_read"> 
                <option {% if gr.make_read %}selected{% end %} value='1'>标记</option> 
                <option {% if not gr.make_read %}selected{% end %} value='0'>不标记</option>
            </select>
        </p>
        <p>
            <label>每个feed最多文章数</label><br />
            <input type="text" name="max_item" size="8" value="{% if gr and gr.max_item %}{{ gr.max_item }}{%else%}50{% end %}" />
        </p>
        <p>
            <label>选择分类</label><br />
            {% if categories %}
            {% for catgory in categories %}
            <label><input type="checkbox" name="categories" {% if catgory.id in gr.categories  %}checked="checked"{% end %} value="{{ catgory.id }}" />{{ catgory.label }}</label>
            {% end %}
            {% end %}
        </p>
        <p>
            <input type="submit" class="btn" value="保存" />
        </p>
        <p>
            你可以点此 <a href="/deliver?test=1">投递测试</a> (注意：投递需一段时间，如果更新内容较多可能会超时失败，但并不代表自动投递会失败)
        </p>
    </fieldset>
</form>
{% else %}
还没有授权google reader账户或授权账户认证失效，<a href="/auth">授权google reader账户</a>
{% end %}

{% end %}